FFT Project Logo
📡 Study Guide · February 2026

Image Denoising with
2D Fast Fourier Transform

Lecturer: Dr. Veng Sotheara

Subject: Math of Data Scince Course: Applications of FFT Track C: Image & 2D FFT Python · NumPy · Matplotlib
1

Introduction

Why Convert to Frequencies?

In pixel form, noise and detail are mixed together — impossible to tell apart. In frequency form, they're automatically separated.

This lets us remove noise cleanly without destroying the actual image — something we can't do pixel by pixel.

The Fast Fourier Transform (FFT) is a clever algorithm invented by Cooley and Tukey in 1965. It converts a signal — like a noisy image — from the regular "what does it look like?" world into the frequency world, where you can see which parts are smooth and which parts are noisy.

Why do we care? Because noise lives at high frequencies, and the real image content lives at low frequencies. Once we separate them, we can remove the noise and put the image back together, cleaner than before.

🎸 Real-World Analogy

Imagine a band is playing music, but a loud fan is making a buzzing noise. If you use an equalizer, you can turn down the high-frequency "buzz" without muting the music. FFT does exactly this — but for images instead of sound.

Why is it "Fast"?
Without the trick, computing the Discrete Fourier Transform (DFT) takes O(N²) steps. For a 1000×1000 image that's 1 billion operations. FFT reduces this to O(N log N) — roughly 10 million operations — a 100× speedup. That's why it changed the world of digital signal processing.

FFT DFT Frequency Domain O(N²) → O(N log N) Cooley-Tukey 1965
2

Theory — How Does FFT Actually Work?

Step 1 — Think of an image as a grid of numbers.
Every pixel has a brightness value (0 = black, 255 = white). An image is just a 2D grid of these numbers.

💡 Example

A 256×256 image = 65,536 numbers. FFT analyzes all of them to ask: "What frequencies make up this image?"

Step 2 — The DFT formula
The 1D Discrete Fourier Transform converts a sequence of values into frequency components:

\( X[k] = \sum_{n=0}^{N-1} x[n] \cdot e^{-j \cdot 2\pi \cdot k \cdot n / N} \)
For each frequency k, we sum up how much of that frequency is present in the signal x[n].
🍰 Analogy — The Recipe Decoder

Think of the DFT like a recipe decoder. Given a cake (the image), it tells you exactly how much flour (low freq), sugar (mid freq), and salt (high freq / noise) are in it. Once you know the amounts, you can adjust them.

📊 From the Presentation — Slide 4
2D FFT: How Images Become Frequencies
The FFT spectrum — center = low frequencies (image content), edges = high frequencies (noise)
The FFT spectrum — center = low frequencies (image content), edges = high frequencies (noise)

Step 3 — Extending to 2D (Images)
For images, we run the 1D FFT on every row first, then on every column. The result is a 2D spectrum where:

💡 Example — What each frequency looks like

Low frequency: A plain blue sky in a photo — barely any variation. Appears as a bright spot at the center of the FFT spectrum.

High frequency: A chain-link fence — lots of rapid changes. Appears far from the center in the spectrum.

Noise: Random pixel variations — they spread energy everywhere in the spectrum, especially at high frequencies.

Computation advantage for images:
Regular 2D DFT = O(N⁴) operations. With FFT = O(N² log N). For a 256×256 image: DFT needs 4 billion steps. FFT needs only ~500,000. FFT is ~8,000× faster!

3

Pipeline — The 5-Step Denoising Process

Here is the complete pipeline used in this project. Think of it as a production line — the noisy image goes in one end and a clean image comes out the other.

🖼️
Step 1
Noisy Input Image
🔄
Step 2
Apply 2D FFT
🎯
Step 3
fftshift to center
🧲
Step 4
Apply Filter Mask
🔁
Step 5
Inverse FFT
Result
Clean Image!
1
Apply 2D FFT to the noisy image

Convert from pixel-space to frequency-space using np.fft.fft2(). Each pixel's brightness becomes a mix of frequency contributions.

2
Use fftshift to move zero-frequency to the center

Normally, low frequencies land at the corners. np.fft.fftshift() reorganizes the spectrum so low frequencies are in the middle — easier to work with visually and mathematically.

3
Design the filter mask

Choose a filter type (Ideal, Gaussian, Butterworth) and a cutoff frequency. The mask is a 2D array of the same size as the image — values near 1 keep frequencies, values near 0 block them. The cutoff controls the trade-off between noise removal and detail preservation.

4
Multiply the shifted spectrum by the filter mask

Element-wise multiplication applies the filter. Frequencies the mask keeps (≈1) pass through; frequencies it blocks (≈0) are suppressed. This is where noise is removed.

5
Apply ifftshift to shift back

Use np.fft.ifftshift() to move the zero-frequency back to the corners. This must happen before the inverse FFT — skipping it produces a spatially incorrect result.

6
Apply Inverse FFT

Use np.fft.ifft2() to convert back from frequency-space to pixel-space. The result is a complex-valued array.

7
Take the real part

Use np.real() to discard the tiny imaginary residuals left by floating-point math. Only the real values represent actual pixel intensities.

8
Clip to [0, 255] and convert to uint8

Floating-point arithmetic can push values slightly outside the valid pixel range. Use np.clip(result, 0, 255).astype(np.uint8) to clamp values and cast back to an 8-bit integer image — ready for display or saving.

📊 From the Presentation — Slide 5
Full Denoising Pipeline Visualization
Complete FFT denoising pipeline: noisy input → FFT → filter → inverse FFT → clean output
Complete FFT denoising pipeline: noisy input → FFT → filter → inverse FFT → clean output
☕ Analogy — Coffee Filter

Imagine pouring coffee through a filter. The filter catches the grounds (noise) while the liquid (real image content) passes through. The FFT filter mask is exactly like that — but for frequencies.

4

Filters — Ideal vs. Gaussian

Two types of low-pass filters were designed and compared. A low-pass filter lets low frequencies pass (keeps smooth image content) and blocks high frequencies (removes noise).

❌ Ideal Low-Pass Filter

  • Binary circle: 1 inside, 0 outside
  • Sharp hard edge at cutoff
  • Creates "ringing artifacts" (Gibbs phenomenon)
  • Like cutting with a knife — too sharp

✅ Gaussian Low-Pass Filter

  • Smooth bell-curve shape
  • Gradual rolloff — no harsh cutoff
  • No ringing artifacts
  • Like fading out — natural and clean
📊 From the Presentation — Slide 6
Filter Design: Ideal vs Gaussian Comparison
Side-by-side comparison of Ideal low-pass filter vs Gaussian filter — note ringing artifacts in ideal filter
Side-by-side comparison of Ideal low-pass filter vs Gaussian filter — note ringing artifacts in ideal filter
\( H(u,v) = e^{-D^2 / 2\sigma^2} \)
D = distance from center. σ = cutoff parameter. When D is small (close to center), H ≈ 1 (pass). When D is large (far from center), H ≈ 0 (block).
💡 Example — Ringing Artifact Explained

You know how when you cut a piece of paper very sharply it sometimes leaves a rough edge? The Ideal Filter does the same thing in frequency space — its sharp cutoff creates wavy ripples around edges in the final image. This is the Gibbs phenomenon.

The Gaussian Filter avoids this because it gradually reduces frequencies instead of abruptly cutting them off — like slowly fading a song rather than stopping it instantly.

What's a "cutoff frequency"?
It's the radius of your filter circle. A smaller cutoff = more aggressive filtering = smoother but blurrier image. A larger cutoff = less filtering = more detail preserved but more noise remains.

In this project, cutoff values from 5 to 115 were tested. The sweet spot was found at cutoff = 45 — best balance between removing noise and keeping detail.

5

Results — Did it Actually Work?

How we measure quality: PSNR (Peak Signal-to-Noise Ratio)
PSNR tells you how close the denoised image is to the original clean image. Higher PSNR = better quality.

\( \text{PSNR} = 20 \cdot \log_{10}\left(\frac{\text{MAX}}{\sqrt{\text{MSE}}}\right) \)
MAX = max pixel value (255). MSE = Mean Squared Error between original and processed image. Higher dB = better.
💡 Example — Understanding dB values

Below 20 dB → Image looks terrible, lots of noise visible.

20–30 dB → Acceptable quality for many applications.

Above 30 dB → Very good quality, noise mostly invisible to human eye.

Our project took a noisy image at 17.65 dB and improved it to 23.28 dB. That's a meaningful improvement — the image went from "visibly noisy" to "acceptable quality."

📊 Final Results Summary

17.65 Noisy Image PSNR (dB)
23.28 Denoised Image PSNR (dB)
+5.63 Improvement (dB)
45 Optimal Cutoff Freq.
📊 From the Presentation — Slide 7
Effect of Filter Cutoff Frequency
Visual comparison of different cutoff frequencies — smaller cutoff = more blur, larger = more noise
Visual comparison of different cutoff frequencies — smaller cutoff = more blur, larger = more noise
📊 From the Presentation — Slide 8
PSNR vs Cutoff Frequency Analysis
PSNR peaks at cutoff = 45, confirming the optimal balance between denoising and detail preservation
PSNR peaks at cutoff = 45, confirming the optimal balance between denoising and detail preservation

Key insight from the cutoff analysis:
As the cutoff increases from 5 to 45, PSNR goes up (we're keeping more of the real image). Past 45, PSNR drops because we start letting noise back in. The optimal cutoff at 45 is the "Goldilocks zone" — not too much filtering, not too little.

+

Bonus — Image Sharpening with High-Pass Filter

The same FFT framework can do the opposite of denoising — sharpening. Instead of a low-pass filter (remove high frequencies), we use a high-pass filter to keep only the high frequencies, which are the edges and fine details.

💡 The Formula

Sharpened = Original + α × High-Frequency Components
α controls how strong the sharpening is. A small α adds a subtle crispness. A large α creates very dramatic edge enhancement (but can look unnatural).

📊 From the Presentation — Slide 10
Image Sharpening with High-Pass Filter
High-pass filtering extracts edge information — adding it back to the original sharpens the image
High-pass filtering extracts edge information — adding it back to the original sharpens the image
6

Limitations — What FFT Denoising Can't Do

No technique is perfect. Here's where FFT-based denoising struggles:

Global Operation

FFT filters affect the entire image uniformly — cannot adapt to local regions where noise or detail varies.

Example: A portrait photo where the face is noisy but the background is already sharp — the filter blurs both equally, softening background detail you wanted to keep.

Noise Type Dependency

Works best for additive Gaussian noise. Structured noise (salt-and-pepper, periodic) needs specialized handling.

Example: A scanned document with regular horizontal lines (periodic noise from the scanner) — FFT low-pass won't remove them because they sit at specific frequencies that need a notch filter, not a low-pass filter.

Detail vs Noise Trade-off

Aggressive filtering removes noise but also blurs genuine edges and fine textures. No single cutoff is perfect everywhere.

Example: At cutoff = 10 the image looks clean but text becomes unreadable and edges dissolve. At cutoff = 80 edges are sharp but noise is still clearly visible. Neither extreme is acceptable.

Manual Tuning Required

Optimal cutoff frequency depends on the specific image and noise level — not automatically adaptive.

Example: A lightly noisy photo may need cutoff = 80 to preserve fine detail, while a heavily corrupted image might need cutoff = 30. There is no universal formula — you test, measure PSNR, and compare.

Future improvements mentioned in the report:
Adaptive filters that vary the cutoff spatially (different settings for different regions), wavelet-based denoising for better edge preservation, and deep learning approaches that use FFT as a feature extraction step.

?

Q&A — Test Your Understanding

Click each question to reveal the answer. Try to guess before you look! 🧠

Q What problem does FFT solve compared to the regular DFT?
Speed. Regular DFT takes O(N²) operations. FFT takes O(N log N). For large images this is thousands of times faster — making it practical for real-world use. Without FFT, processing a single image could take minutes instead of milliseconds.
Q Where does noise appear in the FFT frequency spectrum?
Noise (especially Gaussian noise) spreads its energy uniformly at high frequencies — far from the center of the spectrum. Meanwhile, meaningful image content (shapes, gradients) is concentrated near the center (low frequencies). This separation is exactly what allows us to remove noise without destroying the image.
Q Why is the Gaussian filter better than the Ideal filter?
The Ideal filter has a sharp cutoff — it goes from 1 to 0 instantly at the cutoff radius. This abrupt transition causes ringing artifacts (Gibbs phenomenon) — wavy ripples appearing around edges in the image. The Gaussian filter has a smooth gradual rolloff, so no sharp transitions = no ringing. Result: cleaner, more natural-looking images.
Q What does "low-pass filter" mean? What gets "passed" and what gets blocked?
A low-pass filter lets low frequencies pass through (smooth areas, large shapes, gradients) while blocking high frequencies (noise, sharp edges, fine textures). For denoising, this is perfect because noise is high-frequency. A high-pass filter does the opposite — blocks smooth areas and keeps edges, useful for image sharpening.
Q What does PSNR measure? Is higher or lower better?
PSNR (Peak Signal-to-Noise Ratio) measures how close the processed image is to the original clean image. It compares mean squared error between them and converts it to decibels (dB). Higher PSNR = better quality. In this project, the noisy image had 17.65 dB and after denoising it improved to 23.28 dB — a gain of +5.63 dB.
Q Why isn't a very small cutoff frequency (like 5) the best choice?
A very small cutoff removes almost everything — yes, it eliminates noise, but it also blurs the image heavily because it blocks all the frequencies that define edges and details. You get a clean but unrecognizable, blurry image. The optimal cutoff (45 in this project) balances noise removal against detail preservation.
Q What is fftshift and why is it needed?
After computing the FFT, the zero-frequency component (DC component) — the average brightness — lands at the corners of the spectrum grid. This makes it awkward to design circular filters centered around it. fftshift rearranges the spectrum so that zero-frequency moves to the center. Then we apply the filter, and use an inverse shift before doing IFFT to restore the original layout.
Q Name two limitations of FFT-based denoising.
1. Global operation: The same filter applies to the whole image — it can't handle regions differently (e.g., a noisy sky vs. a sharp foreground object).

2. Type of noise matters: It works well for Gaussian noise but poorly for structured noise like salt-and-pepper or periodic patterns (e.g., scanner lines). Different noise types need different solutions.
Q How is the 2D FFT computed from 1D FFTs?
The 2D FFT is a separable operation. First, apply the 1D FFT to every row of the image. Then apply the 1D FFT to every column of the resulting array. The order doesn't matter (rows then columns = columns then rows). This separability is what makes the 2D FFT efficient — it's just repeated 1D FFTs.
Q What was the noise level added to the test image, and how was it measured?
Gaussian noise with σ = 0.15 was added to a synthetic 256×256 test image. The noisy image's quality was measured using PSNR, giving a value of 17.65 dB relative to the original clean image. After applying the Gaussian low-pass filter with optimal cutoff = 45, PSNR improved to 23.28 dB.